<template>
  <div class="app-container">
    <div class="filter-container">
      <el-form :inline="true" :model="formModel">
        <el-form-item class="no-warn-item" label="参数描述:" prop="paramDescribe">
          <el-input
            v-model="formModel.paramDescribe"
            clearable
          />
        </el-form-item>
        <el-row class="submit-area">
          <el-col :span="24">
            <el-button type="primary" v-if="hasPermission('system_param_select')" plain @click="queryList(false)">查询</el-button>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <hey-table ref="table" :columns="columns" :auto-width="false">
      <template slot="tools">
        <el-table-column
          label="操作"
          width="80"
          fixed="right"
          header-align="center"
          align="center"
        >
          <template slot-scope="{row}">
            <span class="hey_tools_btn" v-if="hasPermission('system_param_edit')" @click="handleEdit(row)">编辑</span>
          </template>
        </el-table-column>
      </template>
    </hey-table>
    <el-dialog
      v-dialogDrag
      v-if="dialogVisible"
      :close-on-click-modal="false"
      title="系统参数维护"
      :visible.sync="dialogVisible"
      width="80%"
    >
      <param-mnt :page-type="operType" :edit-data="editData" @mntSuc="queryList" />
    </el-dialog>

  </div>
</template>

<script>
export default {
  name: 'ParamList',
  components: {
    ParamMnt: () => import('./param-mnt')
  },
  props: {},
  data() {
    return {
      dialogVisible: false,
      operType: '',
      editData: {},
      formModel: {
        paramDescribe: '',
        isDelete: '0',
      },
      columns: [
        { title: '参数描述', key: 'paramDescribe' },
        { title: '参数编码', key: 'paramKey'},
        { title: '参数码值', key: 'paramValue'},
        { title: '创建时间', key: 'createTime' },
        { title: '创建人', key: 'createUsername' },
        { title: '最后修改时间', key: 'lastUpdateTime'},
        { title: '最后修改人', key: 'lastUpdateUsername' },
      ]
    }
  },
  computed: {},
  mounted() {

  },
  methods: {
    queryList() {
      this.$refs.table.query('/globalParamsTbl/queryGlobalParamsTbl', this.formModel, '', false)
    },
    handleEdit(row) {
      this.dialogVisible = true
      this.operType = 'edit'
      this.editData = row || {}
    },
  }
}
</script>

<style lang="scss" scoped>

</style>
